#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
	int num = 0, i = 0;
	char list1[26] = { 0 };
	char list2[80] = { 0 };
	char out[80] = { 0 };
	int len = 0;
	char emp;
	int size;
	for (i; num < 26; ++num, ++i)
	{
		scanf("%c", &list1[i]);
	}


	getchar();
	gets(list2);
	for (i = 0; i < strlen(list2); ++i)
	{
		emp = list2[i];
		if (emp >= 65 && emp <= 90)
		{
			size = emp;
			emp = list1[size - 65] - 32;
		}
		else if (emp >= 97 && emp <= 122)
		{
			size = emp;
			emp = list1[size - 97];
		}
		out[i] = emp;
		len++;
	}
	for (i = 0; i < len; ++i)
	{
		printf("%c", out[i]);
	}

	return 0;
}